<?php

namespace App\Http\Controllers\Admin\Pages;

use App\Facades\UserService;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class UserController extends Controller
{   
    //账号管理
    public function index(Request $request)
    {
        $adminInfoList = UserService::getAllAdminInfo();
        return view("admin/index")->with([
            'admin_infos' => $adminInfoList,
            ]);
    }

    //登录页面
    public function login(Request $request)
    {
        return view('admin/login');
    }

    //用户信息
    public function customers(Request $request)
    {
        $condition = $request->condition;
        $condition = str_replace('%', '\%', $condition);
        $condition = str_replace('_', '\_', $condition);
        $customers = UserService::findUserInfoWithDeviceCode($condition);
        return view('admin/customers')->with([
            'customer_list' => $customers,
            'condition' => $request->condition,
            ]);
    }

}
